package com.ss.android.wenda.answer.list;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.detail.presenter.ActivityStackManager;
import com.ss.android.article.base.feature.detail2.widget.DetailTitleBar;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.common.util.ImmersedStatusBarHelper;
import com.ss.android.topic.c.a;
import org.json.JSONException;
import org.json.JSONObject;

public class AnswerListActivity extends a {
    DetailTitleBar a;
    private String b;
    private long c;
    private AnswerListFragment d;

    public AnswerListActivity() {

    }

    public final String c() {
        return "question";
    }

    public final long d() {
        return this.c;
    }

    private void e() {
        long v6 = 0;
        Intent v0 = this.getIntent();
        if(v0 != null) {
            MobClickCombiner.onEvent(this, ((a)this).c(), "enter", ((a)this).d(), v6, ((a)this).a());
            this.b = v0.getStringExtra("qid");
            try {
                this.c = Long.valueOf(this.b).longValue();
            }
            catch(Exception v0_1) {
                v0_1.printStackTrace();
            }

            if(AppData.getInstance().getAbSettings().isAppLogOld()) {
                MobClickCombiner.onEvent(this, "go_detail", this.b(), this.c, v6, this.a());
            }

            if(!AppData.getInstance().getAbSettings().isAppLogNew()) {
                return;
            }

            JSONObject v0_2 = this.a();
            try {
                v0_2.put("group_id", this.c);
            }
            catch(JSONException v1) {
            }

            this.a("go_detail", v0_2);
        }
    }

    public ImmersedStatusBarHelper.ImmersedStatusBarConfig getImmersedStatusBarConfig() {
        return new ImmersedStatusBarHelper.ImmersedStatusBarConfig().setStatusBarColor(com.ss.android.article.browser.R.color.status_bar_color_detail);
    }

    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        super.onActivityResult(requestCode, resultCode, intent);
        if(requestCode == 100 && resultCode == -1 && this.d != null && !this.isDestroyed()) {
            AnswerListFragment v0 = this.d;
            if(v0.k != null && !v0.isDestroyed()) {
                ++v0.k.mNormalAnswerCount;
                v0.k();
            }
        }
    }

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(com.ss.android.article.browser.R.layout.answer_list_activity);
        this.a = (DetailTitleBar) this.findViewById(com.ss.android.article.browser.R.id.title_bar);
        this.a.setMoreBtnVisibility(false);
        this.d = new AnswerListFragment();
        this.getSupportFragmentManager().beginTransaction().replace(com.ss.android.article.browser.R.id.fragment_container, this.d).commitAllowingStateLoss();
        android.support.design.a.a(this, ((Activity)this).findViewById(com.ss.android.article.browser.R.id.fragment_container));
        this.e();
        ActivityStackManager.addActivity(ActivityStackManager.Type.WENDA_ACTIVITY, ((Activity)this));
    }

    public void onDestroy() {
        super.onDestroy();
        ActivityStackManager.removeActivity(ActivityStackManager.Type.WENDA_ACTIVITY, ((Activity)this));
    }

    public void onNewIntent(Intent arg1) {
        super.onNewIntent(arg1);
        this.e();
    }

    public void onResume() {
        super.onResume();
        this.a.g();
    }
}

